package cn.iocoder.yudao.module.social.convert.container;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.social.controller.admin.container.vo.ContainerCreateReqVO;
import cn.iocoder.yudao.module.social.controller.admin.container.vo.ContainerUpdateReqVO;
import cn.iocoder.yudao.module.social.controller.app.container.vo.AppContainerCreateReqVO;
import cn.iocoder.yudao.module.social.controller.app.container.vo.AppContainerRespVO;
import cn.iocoder.yudao.module.social.controller.app.container.vo.AppContainerUpdateReqVO;
import cn.iocoder.yudao.module.social.dal.dataobject.container.ContainerDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 用户端容器 Convert
 *
 * @author 芋道源码
 */
@Mapper
public interface AppContainerConvert {

    AppContainerConvert INSTANCE = Mappers.getMapper(AppContainerConvert.class);

    @Mapping(target = "id", ignore = true)
    @Mapping(target = "creatorUserId", ignore = true)
    ContainerDO convert(AppContainerCreateReqVO bean);

    @Mapping(target = "creatorUserId", source = "creatorUserId")
    ContainerCreateReqVO convertToAdmin(AppContainerCreateReqVO bean, Long creatorUserId);

    @Mapping(target = "permission", ignore = true)
    @Mapping(target = "creatorUserId", ignore = true)
    ContainerDO convert(AppContainerUpdateReqVO bean);

    @Mapping(target = "creatorUserId", ignore = true)
    ContainerUpdateReqVO convertToAdmin(AppContainerUpdateReqVO bean);

    @Mapping(target = "isMyContainer", ignore = true)
    @Mapping(target = "canEdit", ignore = true)
    @Mapping(target = "canDelete", ignore = true)
    @Mapping(target = "canPost", ignore = true)
    AppContainerRespVO convert(ContainerDO bean);

    List<AppContainerRespVO> convertList(List<ContainerDO> list);

    PageResult<AppContainerRespVO> convertPage(PageResult<ContainerDO> page);

}
